package com.scsj.supermarket.view.fragment.twokindsbasemodel;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.scsj.supermarket.R;
import com.scsj.supermarket.adapter.SixRecommendAdapter;
import com.scsj.supermarket.bean.SixRecommendBean;
import com.scsj.supermarket.customview.MyDecoration;
import com.scsj.supermarket.customview.MyItemDecoration;
import com.scsj.supermarket.view.fragment.basemodel.BaseFragment;
import com.yatoooon.screenadaptation.ScreenAdapterTools;

import java.util.ArrayList;
import java.util.List;

/**
 * 首页功能键新开页面的六个主推类型
 */
public class SixRecommendFragment extends BaseFragment {

    private RecyclerView rv;
    private SixRecommendAdapter adapter;
    private List<SixRecommendBean> list;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View inflate = inflater.inflate(R.layout.fragment_six_recommend, null);

        ScreenAdapterTools.getInstance().loadView(inflate);

        initView(inflate, null);
        initListener();
        initData();

        return inflate;
    }

    @Override
    protected void initView(View view, Bundle savedInstanceState) {
        rv = view.findViewById(R.id.six_recommend_rv);
        rv.setLayoutManager(new GridLayoutManager(getHoldingActivity(), 2));
        rv.setNestedScrollingEnabled(false);
        rv.addItemDecoration(new MyItemDecoration());

    }

    @Override
    protected void initListener() {

    }

    @Override
    protected void initData() {

        list = new ArrayList<>();
//        list.add(new SixRecommendBean("竇愷超市1", "低价畅销", R.mipmap.zzz_clothing));
//        list.add(new SixRecommendBean("竇愷超市2", "低价畅销", R.mipmap.zzz_clothing));
//        list.add(new SixRecommendBean("竇愷超市3", "低价畅销", R.mipmap.zzz_clothing));
//        list.add(new SixRecommendBean("竇愷超市4", "低价畅销", R.mipmap.zzz_clothing));
//        list.add(new SixRecommendBean("竇愷超市5", "低价畅销", R.mipmap.zzz_clothing));
//        list.add(new SixRecommendBean("竇愷超市6", "低价畅销", R.mipmap.zzz_clothing));
        adapter = new SixRecommendAdapter(list);
        rv.setAdapter(adapter);


    }

    @Override
    protected int getLayoutId() {
        return 0;
    }
}
